package com.moson.girl.util;

import com.moson.girl.domain.Result;

/**
 * @Author: MoXingjian
 * @Description:
 * @Date: Created in 16:48 2018/1/28
 * @Modified By:
 */
public class ResultUtil {

    /**
     * 成功
     * @param object 返回的对象
     * @return
     */
    public static Result success(Object object) {
        Result result = new Result();
        result.setCode(1);
        result.setMsg("成功");
        result.setData(object);
        return result;
    }

    public static Result success() {
        return success(null);
    }

    /**
     * 失败
     * @param code 状态码
     * @param msg 信息
     * @return
     */
    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }
}
